package com.shiyi.shiyiaicodefather.service;

import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.shiyi.shiyiaicodefather.model.dto.chatHistory.ChatHistoryQueryRequest;
import com.shiyi.shiyiaicodefather.model.entity.ChatHistory;
import com.shiyi.shiyiaicodefather.model.entity.User;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 对话历史 服务层。
 *
 * @author 十一
 */
public interface ChatHistoryService extends IService<ChatHistory> {

  boolean addChatMessage(Long appId, String message, String messageType, Long userId);

  boolean addChatMessageBatch(List<ChatHistory> chatHistoryList);

  void deleteByAppId(Long appId);

  Page<ChatHistory> listAppChatHistoryByPage(Long appId, int pageSize,
                                             LocalDateTime lastCreateTime,
                                             User loginUser);

    void loadChatHistoryToMemory(Long appId, MessageWindowChatMemory chatMemory, int maxCount);

    QueryWrapper getQueryWrapper(ChatHistoryQueryRequest chatHistoryQueryRequest);
}
